package service.Impl;

import dao.Impl.OrderDaoImpl;
import dao.Impl.UserDaoImpl;
import model.VO.OrderWeekTurnoverVO;
import model.VO.WorkSpaceVO;
import service.WorkSpaceService;

import java.util.List;

public class WorkSpaceServiceImpl implements WorkSpaceService {

    OrderDaoImpl orderDao=new OrderDaoImpl();
    UserDaoImpl userDao=new UserDaoImpl();

    @Override
    public WorkSpaceVO getAll() {
        WorkSpaceVO workSpaceVO = new WorkSpaceVO();

        int totalUsers=userDao.getAll();
        workSpaceVO.setAllUsers(totalUsers);
        int newUsers=userDao.getDayUsers();
        workSpaceVO.setNewUsers(newUsers);
        int allOrderCount=orderDao.getOrderAll();
        workSpaceVO.setAllOrderCount(allOrderCount);
        int orderCount=orderDao.getDayOrderAll();
        workSpaceVO.setOrderCount(orderCount);
        double totalTurnover=orderDao.getTurnoverAll();
        workSpaceVO.setTotalTurnover(totalTurnover);
        double turnover=orderDao.getDayTurnoverAll();
        workSpaceVO.setTurnover(turnover);
        int totalPayCount=orderDao.getPayCountAll();
        workSpaceVO.setTotalPayCount(totalPayCount);
        int payCount=orderDao.getDayPayCountAll();
        workSpaceVO.setPayCount(payCount);

        List<OrderWeekTurnoverVO> turnoverList=orderDao.getWeekTurnover();
        workSpaceVO.setTurnoverList(turnoverList);

        int validOrderCount=orderDao.getDayValidOrderCount();
        workSpaceVO.setValidOrderCount(validOrderCount);
        int monthOrderCount=orderDao.getMonthOrderCount();
        workSpaceVO.setMonthOrderCount(monthOrderCount);
        int monthValidOrderCount=orderDao.getMonthValidOrderCount();
        workSpaceVO.setMonthValidOrderCount(monthValidOrderCount);
        double monthTurnover=orderDao.getMonthTurnover();
        workSpaceVO.setMonthTurnover(monthTurnover);

        int canteen=orderDao.getCanteenCount();
        workSpaceVO.setCanteen(canteen);
        int toGo=orderDao.getToGoCount();
        workSpaceVO.setToGo(toGo);
        return workSpaceVO;

    }
}
